<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>02_css选择器</title>
    <style>
        h4 {
            color: blue;
        }
        #d1 {
            color: red;
            background-color: pink;
            width: 100px;
            height: 200px;
            border: 5px dotted yellow;
        }
        #d2{
            color: yellow;
        }
        .error {
            background-color: lightpink;
        }
        .success {
            background-color: lightgreen;
        }
        .msg {
            color:white;
            border: 5px solid black;
        }
        a:link {
            color:gray;
        }
        a :visited {
            color: blue;
        }
        a:hover {
            color: red;

        }
        a:active {
            color: yellow;
        }
        #d1:hover {
            background-color: lightblue;
        }
        #d3 span{
            background-color: yellow;
        }
        #d3>div>p>span{
            color: red;
        }
        h4,#d3,.error{
            border:5px solid cyan;
        }
        * {
            font-style: italic;
        }
    </style>
</head>
<body>
<div id="d1">我是div</div>
<div id="d2">我是div</div>
<p>我是段落</p>
<p>我是段落</p>
<h4>我是标题</h4>
<h4>我是标题</h4>
<hr>
<span class="error msg">用户名已被占用</span>
<span class="error msg">两次不正确</span>
<span class="error msg">手机格式不正确</span>
<br>
<span class="success msg">有效的邮箱</span>
<span class="success msg">用户名可以使用</span>
<span class="success msg">有效的年龄</span>
<hr>
<a href="https://www.baidu.com">超链接1</a>
<a href="abc">超链接2</a>
<hr>
<div id="d3">
    <span>111</span>
    <div>
        <span>222</span>
        <p>测试文字</p>
        <p>测试<span>333</span>文字</p>
    </div>
    <span>444</span>
</div>
</body>
</html>